<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {include file="/layout/scriptload"}
    <title>修改域名信息</title>
</head>
<body>
<div class="box">
    <!-- /.box-header -->
    <section class="content">
        <div class="box-body">
            <form role="form">
                <div class="form-group col-md-7">
                    <label>域名</label>
                    <input type="text" id="domain" disabled="disabled" class="form-control"  value="{$data.domain}">
                </div>
                <div class="form-group col-md-7">
                    <label>每日分发次数上限</label>
                    <input type="number" id="distribution_num" class="form-control" value="{$data.distribution_num}">
                </div>
                <div class="form-group col-md-7">
                    <label>每十分钟点击次数上限</label>
                    <input type="number" id="cilck_min" class="form-control" value="{$data.click_min}">
                </div>
                <div class="form-group col-md-7">
                    <label>每小时点击次数上限</label>
                    <input type="number" id="cilck_hour" class="form-control" value="{$data.click_hour}">
                </div>
                <div class="form-group col-md-7">
                    <label>每日点击次数上限</label>
                    <input type="number" id="click_day" class="form-control" value="{$data.click_day}">
                </div>
                <div class="form-group col-md-7">
                    <label>权重</label>
                    <input type="text" id="is_weight" class="form-control" value="{$data.is_weight}">
                </div>
                <input type="hidden" value="{$data.id}" id="did">
                <div class="form-group col-md-7" >
                    <div id="btn_save" class="btn pull-right" style="background: #18bc9c;color: #ffffff;">保存</div>
                </div>
            </form>
        </div>
    </section>
</div>
</body>
<script>
    $(function(){
        $('#btn_save').click(function(){
            var _distribution_num = $('#distribution_num').val();
            var _cilck_min = $('#cilck_min').val();
            var _cilck_hour = $('#cilck_hour').val();
            var _click_day = $('#click_day').val();
            var _is_weight = $('#is_weight').val();
            var _did = $('#did').val();
            if(_distribution_num == ''){
                layerAlert('每日分发次数上限不能为空');
                return false;
            }
            if(_cilck_min == ''){
                layerAlert('每十分钟点击次数上限不能为空');
                return false;
            }
            if(_cilck_hour == ''){
                layerAlert('每小时点击次数上限不能为空');
                return false;
            }
            if(_click_day == ''){
                layerAlert('每日点击次数上限不能为空');
                return false;
            }
            $.ajax({
                type:'post',
                cache: false,
                url:"{:url('replyfans/doEditDomain')}",
                data:{id:_did,is_weight:_is_weight,click_min:_cilck_min,click_hour:_cilck_hour,click_day:_click_day,distribution_num:_distribution_num},
                success:function(data){
                    if(data.code==0){
                        layerAlert('修改成功',function(){
                            parent.relist();
                            layerParentClose();
                        });
                    }else{
                        layerAlert('修改失败');
                    }
                }
            })
        })
    })
</script>
</html>